<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="css/amazeui.min.css" />
<link rel="stylesheet" href="css/admin.css" />
</head>
<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户管理</strong><small></small></div>
			</div>
			<hr>
			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<button type="button" class="am-btn am-btn-default btnAdd"><span class="am-icon-plus"></span> 新增</button>
							<button type="button" style="margin-left: 20px;" class="am-btn am-btn-default btnIn">
								<span class="am-icon-child"></span> 在职员工
							</button>
							<button type="button" style="margin-left: 20px;" class="am-btn am-btn-default btnOut">
								<span class="am-icon-child"></span> 离职员工
							</button>
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-3">
				</div>
				<div class="am-u-sm-12 am-u-md-3" style="float: left;">
					<div class="am-input-group am-input-group-sm" style="margin-right: 30px;">
						<input type="text" class="am-form-field" placeholder="请输入用户姓名">
						<span class="am-input-group-btn">
							<button class="am-btn am-btn-default" type="button">搜索</button>
						</span>
					</div>
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-check"><input type="checkbox" id="chkAll"></th>
									<th class="table-id" style="width:100px;">ID</th>
									<th class="table-title">姓名</th>
									<th class="table-type">用户名</th>
									<th class="table-author am-hide-sm-only">性别</th>
									<th class="table-dname">所在部门</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>
							<tbody>
							<c:forEach  items="${list }" var="emp">
							<tr>
									<td><input type="checkbox" name="chk"></td>
									<td>${emp.eid }</td>
									<td>
										<a href="#">${emp.realname }</a>
									</td>
									<td>${emp.ename }</td>
									<c:if test="${emp.esex==0 }">
									<td class="am-hide-sm-only"><span class="am-badge  am-badge-primary ">男</span></td>
									</c:if>
									<c:if test="${emp.esex==1 }">
									<td class="am-hide-sm-only"><span class="am-badge  am-badge-danger ">女</span></td>
									</c:if>
									<td>${emp.dname }</td>
									<td>
									<c:if test="${emp.position==0 }">boss</c:if>
									<c:if test="${emp.position==1 }">经理</c:if>
									<c:if test="${emp.position==2 }">普通员工</c:if>									
									</td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
											<button onclick="editUser(${emp.eid})" type="button" id="depart_24" class="am-btn am-btn-default am-btn-xs am-text-secondary btnedit"><span class="am-icon-pencil-square-o"></span> 编辑</button>
											<c:if test="${emp.estatus==0}">
												<a href="deleteEmp.do?eid=${emp.eid}">
												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger amt-hide-sm-only">
													<span class="am-icon-trash-o"></span> 删除
												</button>
												</a>
												</c:if>
												<c:if test="${emp.estatus==1}">
												<a href="resEmp.do?eid=${emp.eid}">
												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger amt-hide-sm-only">
													<span class="am-icon-archive"></span> <font style="color: green;">恢复</font>
												</button>
												</a>
												</c:if>
											</div>
										</div>
									</td>
								</tr>
							</c:forEach>
							</tbody>
						</table>
						<div class="am-cf" style="margin-right: 30px;">
							共 ${page.count}条记录
							<div class="am-fr" style="float: none;">
								<ul class="am-pagination">
									<li <c:if test="${page.curPage==1}">class="am-disabled"</c:if>>
										<a href="user.do?curPage=${page.curPage-1}">«</a>
									</li>
									<c:forEach step="1" begin="1" end="${page.pages}" var = "p">
									
										<li <c:if test="${page.curPage==p}">class="am-active" </c:if> >
										<a href="user.do?curPage=${p}">${p}</a>
									</li>
									</c:forEach>
									<li <c:if test="${page.curPage==page.pages}">class="am-disabled"</c:if>>
										<a href="user.do?curPage=${page.curPage+1}">»</a>
									</li>
								</ul>
							</div>
						</div>
						<hr>
					</form>
				</div>
			</div>
		</div>

		<script type="text/javascript" src="js/jquery-1.11.3.min.js" ></script>
		<script type="text/javascript" src="myplugs/js/plugs.js" ></script>
		<script>
		function editUser(eid){
			$.jq_Panel({
				title: "编辑员工",
				iframeWidth: 600,
				iframeHeight: 560,
				url: "findUserByEid.do?eid="+eid
			});
		}
		
			$(function() {
				$("#chkAll").chkAll({});
				$(".btnAdd").click(function() {
					$.jq_Panel({
						title: "添加员工",
						iframeWidth: 600,
						iframeHeight: 560,
						url: "getAddDept.do"
					});
				});
				
				
			});
		</script>
	</body>

</html>